<%@page import="java.util.ArrayList"%>
<%@page import="cn.sendto.model.ResidentInfoModel"%>
<%@page import="cn.sendto.model.UserInfoModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="err.jsp"%>
<jsp:include page="lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>个人信息</title>
<style>
.txt20 {
	font-size: 20px;
}

.td {
	font-size: 18px;
	height: 50px;
	text-align: right;
}
</style>
</head>
<%
	request.setCharacterEncoding("UTF-8");
%>
<body>
	<div class="txt20">当前位置-->个人信息</div>
	<%
		request.setCharacterEncoding("UTF-8");
		//判断错误信息
		ArrayList<Integer> errlist = new ArrayList<Integer>();
		if (request.getAttribute("errinfo") != null) {
			errlist = (ArrayList<Integer>) request.getAttribute("errinfo");
		}
		//业主
//	 	if (session.getAttribute("ranks") != null) {
//			if (session.getAttribute("ranks").equals("1") || session.getAttribute("loginResident") != null) {
//				ResidentInfoModel rim = (ResidentInfoModel) session.getAttribute("loginResident");
	%>
<!-- 	<form action="doalterinfo.jsp?rank=1" method="post">
		<table width="95%" cellspacing="1" cellpadding="0" align="center"
			style="background-color: azure">
			<tr>
				<td  height="30px"class="td"> -->
				<%
		//修改后信息
//		if (request.getAttribute("alter") != null) {
//			out.print("<span style='color:red;'>"+request.getAttribute("alter")+"</span>");
//		}
		%>
<%-- 				</td>
				<td></td>
			</tr>
			<tr>
				<td class="td">用户名：</td>
				<td><input type="text" name="username"
					value="<%=rim.getUserName()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<td class="td">姓&nbsp;名：</td>
				<td><input type="text" name="name" value="<%=rim.getName()%>"> --%>
					<%
					//姓名是否输入
//						for (int i = 0; i < errlist.size(); i++) {
//									if (errlist.get(i) == 1) {
//										out.println("<span class=\"star\">*请输入姓名。</span>");
//										break;
//									}
//								}
					%>
		<%-- 			</td>
			</tr>
			<tr>
				<td class="td">性&nbsp;别：</td>
				<td><input type="radio" name="gender" value="男"
					<%=rim.getGender().equals("男") ? "checked=\"checked\"" : " "%>>男
					&nbsp;&nbsp; <input type="radio" value="女" name="gender"
					<%=rim.getGender().equals("女") ? "checked=\"checked\"" : " "%>>女

				</td>
			</tr>
			<tr>
				<td class="td">年&nbsp;龄：</td>
				<td><input type="text" name="age" value="<%=rim.getAge()%>"> --%>
<% 
					//判断年龄是否输入
//						for (int i = 0; i < errlist.size(); i++) {
//									if (errlist.get(i) == 3) {
//										out.println("<span class=\"star\">*请输入年龄。</span>");
//										break;
//									}
//								}
%>	
<!--   					</td>
			</tr>
			<tr>
				<td class="td">电&nbsp;话：</td>
				<td><input type="text" name="tellphone" value=" ">    -->
					<%
// 	for (int i = 0; i < errlist.size(); i++) {
// 				if (errlist.get(i) == 4) {
// 					out.println("<span class=\"star\">*请输入电话。</span>");
// 					break;
// 				}
// 			}
 %>
<%--  </td>
			</tr>
			<tr>
				<td class="td">身份证号：</td>
				<td><input type="text" name="idcard"
					value="<%=rim.getIdCard()%>"> --%> 
					<%
// 	for (int i = 0; i < errlist.size(); i++) {
// 				if (errlist.get(i) == 5) {
//					out.println("<span class=\"star\">*请选择身份证号码。</span>");
// 					break;
// 				}
// 			}
 %>
<!--  </td>
			</tr>
			<tr>
				<td></td>
				<td height="50px"><input type="submit" name="submit" value="修改"
					style="width: 100px; height: 25px"></td>
			</tr>
		</table>
	</form> -->

	<%
	//管理员
	//session.getAttribute("ranks") != null || session.getAttribute("ranks").equals("2")
//		} else
			if (session.getAttribute("loginUser") != null) {
				UserInfoModel uim = (UserInfoModel) session.getAttribute("loginUser");
	%>
	<form action="doalterinfo.jsp?rank=2" method="post">
		<table width="95%" cellspacing="1" cellpadding="0" align="center"
			style="background-color: azure">
			<tr>
				<td colspan="2" height="30px"></td>
			</tr>
			<tr>
				<td class="td">用户名：</td>
				<td><input type="text" name="username"
					value="<%=uim.getUserName()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<td class="td">姓&nbsp;名：</td>
				<td><input type="text" name="name" value="<%=uim.getName()%>">
					<%
						for (int i = 0; i < errlist.size(); i++) {
									if (errlist.get(i) == 1) {
										out.println("<span class=\"star\">*请输入姓名。</span>");
										break;
									}
								}
					%></td>
			</tr>
			<tr>
				<td class="td">电&nbsp;话：</td>
				<td><input type="text" name="usertel"
					value="<%=uim.getUserTel()%>"> <%
 	for (int i = 0; i < errlist.size(); i++) {
 				if (errlist.get(i) == 1) {
 					out.println("<span class=\"star\">*请输入电话号。</span>");
 					break;
 				}
 			}
 %></td>
			</tr>
			<tr>
				<td></td>
				<td height="50px"><input type="submit" name="submit" value="修改"
					style="width: 100px; height: 25px"></td>
			</tr>
		</table>
	</form>
	<%
		} else {
				out.print("请联系管理员");
			}
//		}
	%>
</body>
</html>